<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Cheetah Software: rt_spi.cpp File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Cheetah Software
   &#160;<span id="projectnumber">1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="../../annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="../../files.html"><span>File&#160;List</span></a></li>
      <li><a href="../../globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d1/d62/rt__spi_8cpp.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">rt_spi.cpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;byteswap.h&gt;</code><br />
<code>#include &lt;math.h&gt;</code><br />
<code>#include &lt;pthread.h&gt;</code><br />
<code>#include &lt;stdio.h&gt;</code><br />
<code>#include &lt;string.h&gt;</code><br />
<code>#include &lt;linux/spi/spidev.h&gt;</code><br />
<code>#include &lt;<a class="el" href="../../d0/dae/rt__spi_8h_source.html">rt/rt_spi.h</a>&gt;</code><br />
<code>#include &lt;<a class="el" href="../../d7/d47/rt__spi__lcm_8h_source.html">rt/rt_spi_lcm.h</a>&gt;</code><br />
<code>#include &lt;lcm/lcm-cpp.hpp&gt;</code><br />
</div><div class="textblock"><div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-0-trigger" src="../../closed.png" alt="+"/> Include dependency graph for rt_spi.cpp:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../dd/d6a/rt__spi_8cpp__incl.png" border="0" usemap="#rt__spi_8cpp" alt=""/></div>
<map name="rt__spi_8cpp" id="rt__spi_8cpp">
</map>
</div>
</div>
<p><a href="../../d1/d62/rt__spi_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a10dc9dfda11e6d6371d59bb609ba6996"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a10dc9dfda11e6d6371d59bb609ba6996">spi_open</a> ()</td></tr>
<tr class="separator:a10dc9dfda11e6d6371d59bb609ba6996"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0dd0e7733095f820e5edd3b6ed15b9b2"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a0dd0e7733095f820e5edd3b6ed15b9b2">xor_checksum</a> (uint32_t *data, size_t len)</td></tr>
<tr class="separator:a0dd0e7733095f820e5edd3b6ed15b9b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8e068bf4eccc8576a64472a3ab648bc5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a8e068bf4eccc8576a64472a3ab648bc5">fake_spine_control</a> (spi_command_t *cmd, spi_data_t *data, spi_torque_t *torque_out, int board_num)</td></tr>
<tr class="separator:a8e068bf4eccc8576a64472a3ab648bc5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8eb9780a3438ec02c70314744f91f3c7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a8eb9780a3438ec02c70314744f91f3c7">init_spi</a> ()</td></tr>
<tr class="separator:a8eb9780a3438ec02c70314744f91f3c7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc45f58dc7a8bffa48be85ef06e03309"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#acc45f58dc7a8bffa48be85ef06e03309">spi_to_spine</a> (spi_command_t *cmd, <a class="el" href="../../d1/d9e/structspine__cmd__t.html">spine_cmd_t</a> *spine_cmd, int leg_0)</td></tr>
<tr class="separator:acc45f58dc7a8bffa48be85ef06e03309"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a884cb6c718f657f5aeef5e8b1b5619b7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a884cb6c718f657f5aeef5e8b1b5619b7">spine_to_spi</a> (spi_data_t *data, <a class="el" href="../../de/de1/structspine__data__t.html">spine_data_t</a> *spine_data, int leg_0)</td></tr>
<tr class="separator:a884cb6c718f657f5aeef5e8b1b5619b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a203bbcc4db5a480dbdf813356e836415"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a203bbcc4db5a480dbdf813356e836415">spi_send_receive</a> (spi_command_t *command, spi_data_t *data)</td></tr>
<tr class="separator:a203bbcc4db5a480dbdf813356e836415"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a684e8d785e723147c81388a694a72454"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a684e8d785e723147c81388a694a72454">spi_driver_run</a> ()</td></tr>
<tr class="separator:a684e8d785e723147c81388a694a72454"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e61e97e0ec55d0c36c2883793c12c08"><td class="memItemLeft" align="right" valign="top">spi_command_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a3e61e97e0ec55d0c36c2883793c12c08">get_spi_command</a> ()</td></tr>
<tr class="separator:a3e61e97e0ec55d0c36c2883793c12c08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a86aa57487cebed6685ec3a22729662e6"><td class="memItemLeft" align="right" valign="top">spi_data_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a86aa57487cebed6685ec3a22729662e6">get_spi_data</a> ()</td></tr>
<tr class="separator:a86aa57487cebed6685ec3a22729662e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a6a80c54448b45967f3d0800dea73bf1d"><td class="memItemLeft" align="right" valign="top">lcm::LCM *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a6a80c54448b45967f3d0800dea73bf1d">lcm_spi</a></td></tr>
<tr class="separator:a6a80c54448b45967f3d0800dea73bf1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7623d48573cd46df9d74654f507f0956"><td class="memItemLeft" align="right" valign="top">unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a7623d48573cd46df9d74654f507f0956">spi_mode</a> = SPI_MODE_0</td></tr>
<tr class="separator:a7623d48573cd46df9d74654f507f0956"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80fda0db57659f3b440d379fbfd41a45"><td class="memItemLeft" align="right" valign="top">unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a80fda0db57659f3b440d379fbfd41a45">spi_bits_per_word</a> = 8</td></tr>
<tr class="separator:a80fda0db57659f3b440d379fbfd41a45"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ecca08ad80721125d463d9ea82bab3f"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a2ecca08ad80721125d463d9ea82bab3f">spi_speed</a> = 6000000</td></tr>
<tr class="separator:a2ecca08ad80721125d463d9ea82bab3f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac04c35971c92b7a0ddc152c107c02780"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#ac04c35971c92b7a0ddc152c107c02780">lsb</a> = 0x01</td></tr>
<tr class="separator:ac04c35971c92b7a0ddc152c107c02780"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a57c6f94391b401d4ad7d4a30c7904e73"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a> = -1</td></tr>
<tr class="separator:a57c6f94391b401d4ad7d4a30c7904e73"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a072f113863622b6852dcc6af85b875ed"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a> = -1</td></tr>
<tr class="separator:a072f113863622b6852dcc6af85b875ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab0513fd20c12aea68c75f0ac0e66db63"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="../../d1/d9e/structspine__cmd__t.html">spine_cmd_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#ab0513fd20c12aea68c75f0ac0e66db63">g_spine_cmd</a></td></tr>
<tr class="separator:ab0513fd20c12aea68c75f0ac0e66db63"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1f4dd1dcb93301e0fbb6d1d04681afc0"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="../../de/de1/structspine__data__t.html">spine_data_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a1f4dd1dcb93301e0fbb6d1d04681afc0">g_spine_data</a></td></tr>
<tr class="separator:a1f4dd1dcb93301e0fbb6d1d04681afc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a212699f517cb5bfb2bd42c24e9396a6b"><td class="memItemLeft" align="right" valign="top">spi_command_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a212699f517cb5bfb2bd42c24e9396a6b">spi_command_drv</a></td></tr>
<tr class="separator:a212699f517cb5bfb2bd42c24e9396a6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad5ebd4dd94dc79364380958849464508"><td class="memItemLeft" align="right" valign="top">spi_data_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#ad5ebd4dd94dc79364380958849464508">spi_data_drv</a></td></tr>
<tr class="separator:ad5ebd4dd94dc79364380958849464508"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1225355baf64e608a9d905c4b77df2ff"><td class="memItemLeft" align="right" valign="top">spi_torque_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a1225355baf64e608a9d905c4b77df2ff">spi_torque</a></td></tr>
<tr class="separator:a1225355baf64e608a9d905c4b77df2ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad2b0c4c0380cc217d458a4f849dec246"><td class="memItemLeft" align="right" valign="top">pthread_mutex_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#ad2b0c4c0380cc217d458a4f849dec246">spi_mutex</a></td></tr>
<tr class="separator:ad2b0c4c0380cc217d458a4f849dec246"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad84522629d4afa65f28f64f5450bf871"><td class="memItemLeft" align="right" valign="top">const float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#ad84522629d4afa65f28f64f5450bf871">max_torque</a> [3] = {17.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 17.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 26.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td></tr>
<tr class="separator:ad84522629d4afa65f28f64f5450bf871"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f7481e79512587f08318cd8ef4895e7"><td class="memItemLeft" align="right" valign="top">const float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a2f7481e79512587f08318cd8ef4895e7">wimp_torque</a> [3] = {6.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 6.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 6.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td></tr>
<tr class="separator:a2f7481e79512587f08318cd8ef4895e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5897797ad1ef937e551a794fff823e94"><td class="memItemLeft" align="right" valign="top">const float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a5897797ad1ef937e551a794fff823e94">disabled_torque</a> [3] = {0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td></tr>
<tr class="separator:a5897797ad1ef937e551a794fff823e94"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac1fd38ad01937d4e72d1fa18d7ac07aa"><td class="memItemLeft" align="right" valign="top">const float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#ac1fd38ad01937d4e72d1fa18d7ac07aa">abad_side_sign</a> [4] = {-1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, -1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td></tr>
<tr class="separator:ac1fd38ad01937d4e72d1fa18d7ac07aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5cbed7f1261e2aed04c8d067ae264cf3"><td class="memItemLeft" align="right" valign="top">const float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a5cbed7f1261e2aed04c8d067ae264cf3">hip_side_sign</a> [4] = {-1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, -1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td></tr>
<tr class="separator:a5cbed7f1261e2aed04c8d067ae264cf3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad3821639551d680117b0b03bf096edf4"><td class="memItemLeft" align="right" valign="top">const float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#ad3821639551d680117b0b03bf096edf4">knee_side_sign</a> [4] = {-.6429f, .6429f, -.6429f, .6429f}</td></tr>
<tr class="separator:ad3821639551d680117b0b03bf096edf4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af7ad08857cb188a9397a722c81e209da"><td class="memItemLeft" align="right" valign="top">const float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#af7ad08857cb188a9397a722c81e209da">abad_offset</a> [4] = {0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td></tr>
<tr class="separator:af7ad08857cb188a9397a722c81e209da"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9caf73d43c3d1105974099c178324048"><td class="memItemLeft" align="right" valign="top">const float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a9caf73d43c3d1105974099c178324048">hip_offset</a> [4] = {M_PI / 2.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, -M_PI / 2.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, -M_PI / 2.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, M_PI / 2.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td></tr>
<tr class="separator:a9caf73d43c3d1105974099c178324048"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82d32662d77e7d0cbab964df5cef9d08"><td class="memItemLeft" align="right" valign="top">const float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#a82d32662d77e7d0cbab964df5cef9d08">knee_offset</a> [4]</td></tr>
<tr class="separator:a82d32662d77e7d0cbab964df5cef9d08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae8f69f94e245c5175e96b2f3838685b0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d62/rt__spi_8cpp.html#ae8f69f94e245c5175e96b2f3838685b0">spi_driver_iterations</a> = 0</td></tr>
<tr class="separator:ae8f69f94e245c5175e96b2f3838685b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a8e068bf4eccc8576a64472a3ab648bc5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void fake_spine_control </td>
          <td>(</td>
          <td class="paramtype">spi_command_t *&#160;</td>
          <td class="paramname"><em>cmd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">spi_data_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">spi_torque_t *&#160;</td>
          <td class="paramname"><em>torque_out</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>board_num</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00062">62</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

<p>References <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00035">disabled_torque</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00033">max_torque</a>, and <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00034">wimp_torque</a>.</p>
<div class="fragment"><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;                                                                 {</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  torque_out-&gt;tau_abad[board_num] =</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;      cmd-&gt;kp_abad[board_num] *</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;          (cmd-&gt;q_des_abad[board_num] - data-&gt;q_abad[board_num]) +</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;      cmd-&gt;kd_abad[board_num] *</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;          (cmd-&gt;qd_des_abad[board_num] - data-&gt;qd_abad[board_num]) +</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;      cmd-&gt;tau_abad_ff[board_num];</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;  torque_out-&gt;tau_hip[board_num] =</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;      cmd-&gt;kp_hip[board_num] *</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;          (cmd-&gt;q_des_hip[board_num] - data-&gt;q_hip[board_num]) +</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;      cmd-&gt;kd_hip[board_num] *</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;          (cmd-&gt;qd_des_hip[board_num] - data-&gt;qd_hip[board_num]) +</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;      cmd-&gt;tau_hip_ff[board_num];</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;  torque_out-&gt;tau_knee[board_num] =</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;      cmd-&gt;kp_knee[board_num] *</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;          (cmd-&gt;q_des_knee[board_num] - data-&gt;q_knee[board_num]) +</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;      cmd-&gt;kd_knee[board_num] *</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;          (cmd-&gt;qd_des_knee[board_num] - data-&gt;qd_knee[board_num]) +</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;      cmd-&gt;tau_knee_ff[board_num];</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  <span class="keyword">const</span> <span class="keywordtype">float</span> *torque_limits = <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a5897797ad1ef937e551a794fff823e94">disabled_torque</a>;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;  <span class="keywordflow">if</span> (cmd-&gt;flags[board_num] &amp; 0b1) {</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="keywordflow">if</span> (cmd-&gt;flags[board_num] &amp; 0b10)</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;      torque_limits = <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a2f7481e79512587f08318cd8ef4895e7">wimp_torque</a>;</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <span class="keywordflow">else</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;      torque_limits = <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad84522629d4afa65f28f64f5450bf871">max_torque</a>;</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;  }</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;  <span class="keywordflow">if</span> (torque_out-&gt;tau_abad[board_num] &gt; torque_limits[0])</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    torque_out-&gt;tau_abad[board_num] = torque_limits[0];</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  <span class="keywordflow">if</span> (torque_out-&gt;tau_abad[board_num] &lt; -torque_limits[0])</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    torque_out-&gt;tau_abad[board_num] = -torque_limits[0];</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;  <span class="keywordflow">if</span> (torque_out-&gt;tau_hip[board_num] &gt; torque_limits[1])</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    torque_out-&gt;tau_hip[board_num] = torque_limits[1];</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;  <span class="keywordflow">if</span> (torque_out-&gt;tau_hip[board_num] &lt; -torque_limits[1])</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    torque_out-&gt;tau_hip[board_num] = -torque_limits[1];</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  <span class="keywordflow">if</span> (torque_out-&gt;tau_knee[board_num] &gt; torque_limits[2])</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    torque_out-&gt;tau_knee[board_num] = torque_limits[2];</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;  <span class="keywordflow">if</span> (torque_out-&gt;tau_knee[board_num] &lt; -torque_limits[2])</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    torque_out-&gt;tau_knee[board_num] = -torque_limits[2];</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;}</div><div class="ttc" id="rt__spi_8cpp_html_ad84522629d4afa65f28f64f5450bf871"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ad84522629d4afa65f28f64f5450bf871">max_torque</a></div><div class="ttdeci">const float max_torque[3]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00033">rt_spi.cpp:33</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a5897797ad1ef937e551a794fff823e94"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a5897797ad1ef937e551a794fff823e94">disabled_torque</a></div><div class="ttdeci">const float disabled_torque[3]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00035">rt_spi.cpp:35</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a2f7481e79512587f08318cd8ef4895e7"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a2f7481e79512587f08318cd8ef4895e7">wimp_torque</a></div><div class="ttdeci">const float wimp_torque[3]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00034">rt_spi.cpp:34</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-1" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-1-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-1-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-1-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a8e068bf4eccc8576a64472a3ab648bc5_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a8e068bf4eccc8576a64472a3ab648bc5_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a8e068bf4eccc8576a64472a3ab648bc5_icgraph" id="d1/d62/rt__spi_8cpp_a8e068bf4eccc8576a64472a3ab648bc5_icgraph">
</map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a3e61e97e0ec55d0c36c2883793c12c08"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">spi_command_t* get_spi_command </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00332">332</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

<p>References <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00027">spi_command_drv</a>.</p>
<div class="fragment"><div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;                                 {</div><div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;  <span class="comment">// printf(&quot;Get spi command\n&quot;);</span></div><div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;  <span class="keywordflow">return</span> &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a212699f517cb5bfb2bd42c24e9396a6b">spi_command_drv</a>;</div><div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;}</div><div class="ttc" id="rt__spi_8cpp_html_a212699f517cb5bfb2bd42c24e9396a6b"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a212699f517cb5bfb2bd42c24e9396a6b">spi_command_drv</a></div><div class="ttdeci">spi_command_t spi_command_drv</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00027">rt_spi.cpp:27</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-2" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-2-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-2-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-2-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a3e61e97e0ec55d0c36c2883793c12c08_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a3e61e97e0ec55d0c36c2883793c12c08_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a3e61e97e0ec55d0c36c2883793c12c08_icgraph" id="d1/d62/rt__spi_8cpp_a3e61e97e0ec55d0c36c2883793c12c08_icgraph">
</map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a86aa57487cebed6685ec3a22729662e6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">spi_data_t* get_spi_data </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00337">337</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

<p>References <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00028">spi_data_drv</a>.</p>
<div class="fragment"><div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;{ <span class="keywordflow">return</span> &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad5ebd4dd94dc79364380958849464508">spi_data_drv</a>; }</div><div class="ttc" id="rt__spi_8cpp_html_ad5ebd4dd94dc79364380958849464508"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ad5ebd4dd94dc79364380958849464508">spi_data_drv</a></div><div class="ttdeci">spi_data_t spi_data_drv</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00028">rt_spi.cpp:28</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-3" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-3-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-3-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-3-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a86aa57487cebed6685ec3a22729662e6_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a86aa57487cebed6685ec3a22729662e6_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a86aa57487cebed6685ec3a22729662e6_icgraph" id="d1/d62/rt__spi_8cpp_a86aa57487cebed6685ec3a22729662e6_icgraph">
</map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a8eb9780a3438ec02c70314744f91f3c7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void init_spi </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00110">110</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

<p>References <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00027">K_EXPECTED_COMMAND_SIZE</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00029">K_EXPECTED_DATA_SIZE</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00027">spi_command_drv</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00028">spi_data_drv</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00031">spi_mutex</a>, and <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00137">spi_open()</a>.</p>
<div class="fragment"><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;                {</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;  <span class="comment">// check sizes:</span></div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;  <span class="keywordtype">size_t</span> command_size = <span class="keyword">sizeof</span>(spi_command_t);</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;  <span class="keywordtype">size_t</span> data_size = <span class="keyword">sizeof</span>(spi_data_t);</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  memset(&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a212699f517cb5bfb2bd42c24e9396a6b">spi_command_drv</a>, 0, <span class="keyword">sizeof</span>(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a212699f517cb5bfb2bd42c24e9396a6b">spi_command_drv</a>));</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;  memset(&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad5ebd4dd94dc79364380958849464508">spi_data_drv</a>, 0, <span class="keyword">sizeof</span>(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad5ebd4dd94dc79364380958849464508">spi_data_drv</a>));</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  <span class="keywordflow">if</span> (pthread_mutex_init(&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad2b0c4c0380cc217d458a4f849dec246">spi_mutex</a>, NULL) != 0)</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    printf(<span class="stringliteral">&quot;[ERROR: RT SPI] Failed to create spi data mutex\n&quot;</span>);</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;  <span class="keywordflow">if</span> (command_size != <a class="code" href="../../d0/dae/rt__spi_8h.html#a16e1750a8c350d6bdf5ee34ac1f2b725">K_EXPECTED_COMMAND_SIZE</a>) {</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    printf(<span class="stringliteral">&quot;[RT SPI] Error command size is %ld, expected %d\n&quot;</span>, command_size,</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;           <a class="code" href="../../d0/dae/rt__spi_8h.html#a16e1750a8c350d6bdf5ee34ac1f2b725">K_EXPECTED_COMMAND_SIZE</a>);</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;  } <span class="keywordflow">else</span></div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    printf(<span class="stringliteral">&quot;[RT SPI] command size good\n&quot;</span>);</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  <span class="keywordflow">if</span> (data_size != <a class="code" href="../../d0/dae/rt__spi_8h.html#a63377a4b9d48b89d4d14253399f9d3e5">K_EXPECTED_DATA_SIZE</a>) {</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    printf(<span class="stringliteral">&quot;[RT SPI] Error data size is %ld, expected %d\n&quot;</span>, data_size,</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;           <a class="code" href="../../d0/dae/rt__spi_8h.html#a63377a4b9d48b89d4d14253399f9d3e5">K_EXPECTED_DATA_SIZE</a>);</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;  } <span class="keywordflow">else</span></div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    printf(<span class="stringliteral">&quot;[RT SPI] data size good\n&quot;</span>);</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  printf(<span class="stringliteral">&quot;[RT SPI] Open\n&quot;</span>);</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;  <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a10dc9dfda11e6d6371d59bb609ba6996">spi_open</a>();</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;}</div><div class="ttc" id="rt__spi_8h_html_a16e1750a8c350d6bdf5ee34ac1f2b725"><div class="ttname"><a href="../../d0/dae/rt__spi_8h.html#a16e1750a8c350d6bdf5ee34ac1f2b725">K_EXPECTED_COMMAND_SIZE</a></div><div class="ttdeci">#define K_EXPECTED_COMMAND_SIZE</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00027">rt_spi.h:27</a></div></div>
<div class="ttc" id="rt__spi_8h_html_a63377a4b9d48b89d4d14253399f9d3e5"><div class="ttname"><a href="../../d0/dae/rt__spi_8h.html#a63377a4b9d48b89d4d14253399f9d3e5">K_EXPECTED_DATA_SIZE</a></div><div class="ttdeci">#define K_EXPECTED_DATA_SIZE</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00029">rt_spi.h:29</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ad2b0c4c0380cc217d458a4f849dec246"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ad2b0c4c0380cc217d458a4f849dec246">spi_mutex</a></div><div class="ttdeci">pthread_mutex_t spi_mutex</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00031">rt_spi.cpp:31</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ad5ebd4dd94dc79364380958849464508"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ad5ebd4dd94dc79364380958849464508">spi_data_drv</a></div><div class="ttdeci">spi_data_t spi_data_drv</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00028">rt_spi.cpp:28</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a10dc9dfda11e6d6371d59bb609ba6996"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a10dc9dfda11e6d6371d59bb609ba6996">spi_open</a></div><div class="ttdeci">int spi_open()</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00137">rt_spi.cpp:137</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a212699f517cb5bfb2bd42c24e9396a6b"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a212699f517cb5bfb2bd42c24e9396a6b">spi_command_drv</a></div><div class="ttdeci">spi_command_t spi_command_drv</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00027">rt_spi.cpp:27</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-4" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-4-trigger" src="../../closed.png" alt="+"/> Here is the call graph for this function:</div>
<div id="dynsection-4-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-4-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a8eb9780a3438ec02c70314744f91f3c7_cgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a8eb9780a3438ec02c70314744f91f3c7_cgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a8eb9780a3438ec02c70314744f91f3c7_cgraph" id="d1/d62/rt__spi_8cpp_a8eb9780a3438ec02c70314744f91f3c7_cgraph">
</map>
</div>
</p>

<p><div id="dynsection-5" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-5-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-5-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-5-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a8eb9780a3438ec02c70314744f91f3c7_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a8eb9780a3438ec02c70314744f91f3c7_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a8eb9780a3438ec02c70314744f91f3c7_icgraph" id="d1/d62/rt__spi_8cpp_a8eb9780a3438ec02c70314744f91f3c7_icgraph">
</map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a684e8d785e723147c81388a694a72454"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void spi_driver_run </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00319">319</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

<p>References <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00062">fake_spine_control()</a>, <a class="el" href="../../dd/ddf/rt__spi__lcm_8cpp_source.html#l00016">publish_spi_torque()</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00027">spi_command_drv</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00028">spi_data_drv</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00031">spi_mutex</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00260">spi_send_receive()</a>, and <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00029">spi_torque</a>.</p>
<div class="fragment"><div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;                      {</div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;  <span class="comment">// do spi board calculations</span></div><div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; i++) {</div><div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;    <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a8e068bf4eccc8576a64472a3ab648bc5">fake_spine_control</a>(&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a212699f517cb5bfb2bd42c24e9396a6b">spi_command_drv</a>, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad5ebd4dd94dc79364380958849464508">spi_data_drv</a>, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a1225355baf64e608a9d905c4b77df2ff">spi_torque</a>, i);</div><div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;  }</div><div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;  <a class="code" href="../../d7/d47/rt__spi__lcm_8h.html#a8793654fc8604008f59e9fdb0ed3ad5c">publish_spi_torque</a>(&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a1225355baf64e608a9d905c4b77df2ff">spi_torque</a>);</div><div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;</div><div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;  <span class="comment">// in here, the driver is good</span></div><div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;  pthread_mutex_lock(&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad2b0c4c0380cc217d458a4f849dec246">spi_mutex</a>);</div><div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;  <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a203bbcc4db5a480dbdf813356e836415">spi_send_receive</a>(&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a212699f517cb5bfb2bd42c24e9396a6b">spi_command_drv</a>, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad5ebd4dd94dc79364380958849464508">spi_data_drv</a>);</div><div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;  pthread_mutex_unlock(&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad2b0c4c0380cc217d458a4f849dec246">spi_mutex</a>);</div><div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;}</div><div class="ttc" id="rt__spi_8cpp_html_a203bbcc4db5a480dbdf813356e836415"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a203bbcc4db5a480dbdf813356e836415">spi_send_receive</a></div><div class="ttdeci">void spi_send_receive(spi_command_t *command, spi_data_t *data)</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00260">rt_spi.cpp:260</a></div></div>
<div class="ttc" id="rt__spi__lcm_8h_html_a8793654fc8604008f59e9fdb0ed3ad5c"><div class="ttname"><a href="../../d7/d47/rt__spi__lcm_8h.html#a8793654fc8604008f59e9fdb0ed3ad5c">publish_spi_torque</a></div><div class="ttdeci">void publish_spi_torque(spi_torque_t *data)</div><div class="ttdef"><b>Definition:</b> <a href="../../dd/ddf/rt__spi__lcm_8cpp_source.html#l00016">rt_spi_lcm.cpp:16</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ad2b0c4c0380cc217d458a4f849dec246"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ad2b0c4c0380cc217d458a4f849dec246">spi_mutex</a></div><div class="ttdeci">pthread_mutex_t spi_mutex</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00031">rt_spi.cpp:31</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a8e068bf4eccc8576a64472a3ab648bc5"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a8e068bf4eccc8576a64472a3ab648bc5">fake_spine_control</a></div><div class="ttdeci">void fake_spine_control(spi_command_t *cmd, spi_data_t *data, spi_torque_t *torque_out, int board_num)</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00062">rt_spi.cpp:62</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a1225355baf64e608a9d905c4b77df2ff"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a1225355baf64e608a9d905c4b77df2ff">spi_torque</a></div><div class="ttdeci">spi_torque_t spi_torque</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00029">rt_spi.cpp:29</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ad5ebd4dd94dc79364380958849464508"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ad5ebd4dd94dc79364380958849464508">spi_data_drv</a></div><div class="ttdeci">spi_data_t spi_data_drv</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00028">rt_spi.cpp:28</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a212699f517cb5bfb2bd42c24e9396a6b"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a212699f517cb5bfb2bd42c24e9396a6b">spi_command_drv</a></div><div class="ttdeci">spi_command_t spi_command_drv</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00027">rt_spi.cpp:27</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-6" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-6-trigger" src="../../closed.png" alt="+"/> Here is the call graph for this function:</div>
<div id="dynsection-6-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-6-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a684e8d785e723147c81388a694a72454_cgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a684e8d785e723147c81388a694a72454_cgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a684e8d785e723147c81388a694a72454_cgraph" id="d1/d62/rt__spi_8cpp_a684e8d785e723147c81388a694a72454_cgraph">
</map>
</div>
</p>

<p><div id="dynsection-7" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-7-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-7-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-7-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a684e8d785e723147c81388a694a72454_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a684e8d785e723147c81388a694a72454_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a684e8d785e723147c81388a694a72454_icgraph" id="d1/d62/rt__spi_8cpp_a684e8d785e723147c81388a694a72454_icgraph">
</map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a10dc9dfda11e6d6371d59bb609ba6996"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int spi_open </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00137">137</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

<p>References <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00017">lsb</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00019">spi_1_fd</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00020">spi_2_fd</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00015">spi_bits_per_word</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00014">spi_mode</a>, and <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00016">spi_speed</a>.</p>
<div class="fragment"><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;               {</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;  <span class="keywordtype">int</span> rv = 0;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;  <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a> = open(<span class="stringliteral">&quot;/dev/spidev2.0&quot;</span>, O_RDWR);</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a> &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] Couldn&#39;t open spidev 2.0&quot;</span>);</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;  <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a> = open(<span class="stringliteral">&quot;/dev/spidev2.1&quot;</span>, O_RDWR);</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a> &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] Couldn&#39;t open spidev 2.1&quot;</span>);</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a>, SPI_IOC_WR_MODE, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a7623d48573cd46df9d74654f507f0956">spi_mode</a>);</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_wr_mode (1)&quot;</span>);</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a>, SPI_IOC_WR_MODE, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a7623d48573cd46df9d74654f507f0956">spi_mode</a>);</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_wr_mode (2)&quot;</span>);</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a>, SPI_IOC_RD_MODE, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a7623d48573cd46df9d74654f507f0956">spi_mode</a>);</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_rd_mode (1)&quot;</span>);</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a>, SPI_IOC_RD_MODE, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a7623d48573cd46df9d74654f507f0956">spi_mode</a>);</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_rd_mode (2)&quot;</span>);</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a>, SPI_IOC_WR_BITS_PER_WORD, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a80fda0db57659f3b440d379fbfd41a45">spi_bits_per_word</a>);</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_wr_bits_per_word (1)&quot;</span>);</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a>, SPI_IOC_WR_BITS_PER_WORD, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a80fda0db57659f3b440d379fbfd41a45">spi_bits_per_word</a>);</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_wr_bits_per_word (2)&quot;</span>);</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a>, SPI_IOC_RD_BITS_PER_WORD, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a80fda0db57659f3b440d379fbfd41a45">spi_bits_per_word</a>);</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_rd_bits_per_word (1)&quot;</span>);</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a>, SPI_IOC_RD_BITS_PER_WORD, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a80fda0db57659f3b440d379fbfd41a45">spi_bits_per_word</a>);</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_rd_bits_per_word (2)&quot;</span>);</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a>, SPI_IOC_WR_MAX_SPEED_HZ, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a2ecca08ad80721125d463d9ea82bab3f">spi_speed</a>);</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_wr_max_speed_hz (1)&quot;</span>);</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a>, SPI_IOC_WR_MAX_SPEED_HZ, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a2ecca08ad80721125d463d9ea82bab3f">spi_speed</a>);</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_wr_max_speed_hz (2)&quot;</span>);</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a>, SPI_IOC_RD_MAX_SPEED_HZ, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a2ecca08ad80721125d463d9ea82bab3f">spi_speed</a>);</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_rd_max_speed_hz (1)&quot;</span>);</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a>, SPI_IOC_RD_MAX_SPEED_HZ, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a2ecca08ad80721125d463d9ea82bab3f">spi_speed</a>);</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_rd_max_speed_hz (2)&quot;</span>);</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a>, SPI_IOC_RD_LSB_FIRST, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ac04c35971c92b7a0ddc152c107c02780">lsb</a>);</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_rd_lsb_first (1)&quot;</span>);</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;  rv = ioctl(<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a>, SPI_IOC_RD_LSB_FIRST, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ac04c35971c92b7a0ddc152c107c02780">lsb</a>);</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;  <span class="keywordflow">if</span> (rv &lt; 0) perror(<span class="stringliteral">&quot;[ERROR] ioctl spi_ioc_rd_lsb_first (2)&quot;</span>);</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;  <span class="keywordflow">return</span> rv;</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;}</div><div class="ttc" id="rt__spi_8cpp_html_a2ecca08ad80721125d463d9ea82bab3f"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a2ecca08ad80721125d463d9ea82bab3f">spi_speed</a></div><div class="ttdeci">unsigned int spi_speed</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00016">rt_spi.cpp:16</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a80fda0db57659f3b440d379fbfd41a45"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a80fda0db57659f3b440d379fbfd41a45">spi_bits_per_word</a></div><div class="ttdeci">unsigned char spi_bits_per_word</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00015">rt_spi.cpp:15</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a072f113863622b6852dcc6af85b875ed"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a></div><div class="ttdeci">int spi_2_fd</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00020">rt_spi.cpp:20</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a7623d48573cd46df9d74654f507f0956"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a7623d48573cd46df9d74654f507f0956">spi_mode</a></div><div class="ttdeci">unsigned char spi_mode</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00014">rt_spi.cpp:14</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ac04c35971c92b7a0ddc152c107c02780"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ac04c35971c92b7a0ddc152c107c02780">lsb</a></div><div class="ttdeci">uint8_t lsb</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00017">rt_spi.cpp:17</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a57c6f94391b401d4ad7d4a30c7904e73"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a></div><div class="ttdeci">int spi_1_fd</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00019">rt_spi.cpp:19</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-8" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-8-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-8-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-8-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a10dc9dfda11e6d6371d59bb609ba6996_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a10dc9dfda11e6d6371d59bb609ba6996_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a10dc9dfda11e6d6371d59bb609ba6996_icgraph" id="d1/d62/rt__spi_8cpp_a10dc9dfda11e6d6371d59bb609ba6996_icgraph">
</map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a203bbcc4db5a480dbdf813356e836415"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void spi_send_receive </td>
          <td>(</td>
          <td class="paramtype">spi_command_t *&#160;</td>
          <td class="paramname"><em>command</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">spi_data_t *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00260">260</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

<p>References <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00028">K_WORDS_PER_MESSAGE</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00019">spi_1_fd</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00020">spi_2_fd</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00015">spi_bits_per_word</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00186">spi_driver_iterations</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00189">spi_to_spine()</a>, and <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00235">spine_to_spi()</a>.</p>
<div class="fragment"><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;                                                                {</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;  <span class="comment">// update driver status flag</span></div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;  <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ae8f69f94e245c5175e96b2f3838685b0">spi_driver_iterations</a>++;</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;  data-&gt;spi_driver_status = <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ae8f69f94e245c5175e96b2f3838685b0">spi_driver_iterations</a> &lt;&lt; 16;</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;  <span class="comment">// transmit and receive buffers</span></div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;  uint16_t tx_buf[<a class="code" href="../../d0/dae/rt__spi_8h.html#adc2caca9802fd1471258f8fd6a06a727">K_WORDS_PER_MESSAGE</a>];</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;  uint16_t rx_buf[<a class="code" href="../../d0/dae/rt__spi_8h.html#adc2caca9802fd1471258f8fd6a06a727">K_WORDS_PER_MESSAGE</a>];</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> spi_board = 0; spi_board &lt; 2; spi_board++) {</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;    <span class="comment">// copy command into spine type:</span></div><div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;    <a class="code" href="../../d1/d62/rt__spi_8cpp.html#acc45f58dc7a8bffa48be85ef06e03309">spi_to_spine</a>(command, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ab0513fd20c12aea68c75f0ac0e66db63">g_spine_cmd</a>, spi_board * 2);</div><div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;</div><div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;    <span class="comment">// pointers to command/data spine array</span></div><div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;    uint16_t *cmd_d = (uint16_t *)&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#ab0513fd20c12aea68c75f0ac0e66db63">g_spine_cmd</a>;</div><div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    uint16_t *data_d = (uint16_t *)&amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a1f4dd1dcb93301e0fbb6d1d04681afc0">g_spine_data</a>;</div><div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;</div><div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;    <span class="comment">// zero rx buffer</span></div><div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;    memset(rx_buf, 0, <a class="code" href="../../d0/dae/rt__spi_8h.html#adc2caca9802fd1471258f8fd6a06a727">K_WORDS_PER_MESSAGE</a> * <span class="keyword">sizeof</span>(uint16_t));</div><div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;</div><div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;    <span class="comment">// copy into tx buffer flipping bytes</span></div><div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="../../d0/dae/rt__spi_8h.html#adc2caca9802fd1471258f8fd6a06a727">K_WORDS_PER_MESSAGE</a>; i++)</div><div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;      tx_buf[i] = (cmd_d[i] &gt;&gt; 8) + ((cmd_d[i] &amp; 0xff) &lt;&lt; 8);</div><div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;    <span class="comment">// tx_buf[i] = __bswap_16(cmd_d[i]);</span></div><div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;</div><div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;    <span class="comment">// each word is two bytes long</span></div><div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;    <span class="keywordtype">size_t</span> word_len = 2;  <span class="comment">// 16 bit word</span></div><div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;</div><div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;    <span class="comment">// spi message struct</span></div><div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;    <span class="keyword">struct </span>spi_ioc_transfer spi_message[1];</div><div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;</div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;    <span class="comment">// zero message struct.</span></div><div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;    memset(spi_message, 0, 1 * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> spi_ioc_transfer));</div><div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;</div><div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;    <span class="comment">// set up message struct</span></div><div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 1; i++) {</div><div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;      spi_message[i].bits_per_word = <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a80fda0db57659f3b440d379fbfd41a45">spi_bits_per_word</a>;</div><div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;      spi_message[i].cs_change = 1;</div><div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;      spi_message[i].delay_usecs = 0;</div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;      spi_message[i].len = word_len * 66;</div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;      spi_message[i].rx_buf = (uint64_t)rx_buf;</div><div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;      spi_message[i].tx_buf = (uint64_t)tx_buf;</div><div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;    }</div><div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;</div><div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;    <span class="comment">// do spi communication</span></div><div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;    <span class="keywordtype">int</span> rv = ioctl(spi_board == 0 ? <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a> : <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a>, SPI_IOC_MESSAGE(1),</div><div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;                   &amp;spi_message);</div><div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;    (void)rv;</div><div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;</div><div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;    <span class="comment">// flip bytes the other way</span></div><div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 30; i++)</div><div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;      data_d[i] = (rx_buf[i] &gt;&gt; 8) + ((rx_buf[i] &amp; 0xff) &lt;&lt; 8);</div><div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;    <span class="comment">// data_d[i] = __bswap_16(rx_buf[i]);</span></div><div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;</div><div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;    <span class="comment">// copy back to data</span></div><div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;    <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a884cb6c718f657f5aeef5e8b1b5619b7">spine_to_spi</a>(data, &amp;<a class="code" href="../../d1/d62/rt__spi_8cpp.html#a1f4dd1dcb93301e0fbb6d1d04681afc0">g_spine_data</a>, spi_board * 2);</div><div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;  }</div><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;}</div><div class="ttc" id="rt__spi_8cpp_html_a1f4dd1dcb93301e0fbb6d1d04681afc0"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a1f4dd1dcb93301e0fbb6d1d04681afc0">g_spine_data</a></div><div class="ttdeci">static spine_data_t g_spine_data</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00025">rt_spi.cpp:25</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a80fda0db57659f3b440d379fbfd41a45"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a80fda0db57659f3b440d379fbfd41a45">spi_bits_per_word</a></div><div class="ttdeci">unsigned char spi_bits_per_word</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00015">rt_spi.cpp:15</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a072f113863622b6852dcc6af85b875ed"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a072f113863622b6852dcc6af85b875ed">spi_2_fd</a></div><div class="ttdeci">int spi_2_fd</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00020">rt_spi.cpp:20</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a884cb6c718f657f5aeef5e8b1b5619b7"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a884cb6c718f657f5aeef5e8b1b5619b7">spine_to_spi</a></div><div class="ttdeci">void spine_to_spi(spi_data_t *data, spine_data_t *spine_data, int leg_0)</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00235">rt_spi.cpp:235</a></div></div>
<div class="ttc" id="rt__spi_8h_html_adc2caca9802fd1471258f8fd6a06a727"><div class="ttname"><a href="../../d0/dae/rt__spi_8h.html#adc2caca9802fd1471258f8fd6a06a727">K_WORDS_PER_MESSAGE</a></div><div class="ttdeci">#define K_WORDS_PER_MESSAGE</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00028">rt_spi.h:28</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ab0513fd20c12aea68c75f0ac0e66db63"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ab0513fd20c12aea68c75f0ac0e66db63">g_spine_cmd</a></div><div class="ttdeci">static spine_cmd_t g_spine_cmd</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00024">rt_spi.cpp:24</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ae8f69f94e245c5175e96b2f3838685b0"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ae8f69f94e245c5175e96b2f3838685b0">spi_driver_iterations</a></div><div class="ttdeci">int spi_driver_iterations</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00186">rt_spi.cpp:186</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_acc45f58dc7a8bffa48be85ef06e03309"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#acc45f58dc7a8bffa48be85ef06e03309">spi_to_spine</a></div><div class="ttdeci">void spi_to_spine(spi_command_t *cmd, spine_cmd_t *spine_cmd, int leg_0)</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00189">rt_spi.cpp:189</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a57c6f94391b401d4ad7d4a30c7904e73"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a57c6f94391b401d4ad7d4a30c7904e73">spi_1_fd</a></div><div class="ttdeci">int spi_1_fd</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00019">rt_spi.cpp:19</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-9" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-9-trigger" src="../../closed.png" alt="+"/> Here is the call graph for this function:</div>
<div id="dynsection-9-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-9-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a203bbcc4db5a480dbdf813356e836415_cgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a203bbcc4db5a480dbdf813356e836415_cgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a203bbcc4db5a480dbdf813356e836415_cgraph" id="d1/d62/rt__spi_8cpp_a203bbcc4db5a480dbdf813356e836415_cgraph">
</map>
</div>
</p>

<p><div id="dynsection-10" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-10-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-10-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-10-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a203bbcc4db5a480dbdf813356e836415_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a203bbcc4db5a480dbdf813356e836415_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a203bbcc4db5a480dbdf813356e836415_icgraph" id="d1/d62/rt__spi_8cpp_a203bbcc4db5a480dbdf813356e836415_icgraph">
</map>
</div>
</p>

</div>
</div>
<a class="anchor" id="acc45f58dc7a8bffa48be85ef06e03309"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void spi_to_spine </td>
          <td>(</td>
          <td class="paramtype">spi_command_t *&#160;</td>
          <td class="paramname"><em>cmd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../d1/d9e/structspine__cmd__t.html">spine_cmd_t</a> *&#160;</td>
          <td class="paramname"><em>spine_cmd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>leg_0</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00189">189</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

<p>References <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00043">abad_offset</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00038">abad_side_sign</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00064">spine_cmd_t::checksum</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00063">spine_cmd_t::flags</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00044">hip_offset</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00039">hip_side_sign</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00057">spine_cmd_t::kd_abad</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00058">spine_cmd_t::kd_hip</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00059">spine_cmd_t::kd_knee</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00045">knee_offset</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00040">knee_side_sign</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00054">spine_cmd_t::kp_abad</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00055">spine_cmd_t::kp_hip</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00056">spine_cmd_t::kp_knee</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00048">spine_cmd_t::q_des_abad</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00049">spine_cmd_t::q_des_hip</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00050">spine_cmd_t::q_des_knee</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00051">spine_cmd_t::qd_des_abad</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00052">spine_cmd_t::qd_des_hip</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00053">spine_cmd_t::qd_des_knee</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00060">spine_cmd_t::tau_abad_ff</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00061">spine_cmd_t::tau_hip_ff</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00062">spine_cmd_t::tau_knee_ff</a>, and <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00048">xor_checksum()</a>.</p>
<div class="fragment"><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;                                                                         {</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 2; i++) {</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <span class="comment">// spine_cmd-&gt;q_des_abad[i] = (cmd-&gt;q_des_abad[i+leg_0] +</span></div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="comment">// abad_offset[i+leg_0]) * abad_side_sign[i+leg_0]; spine_cmd-&gt;q_des_hip[i]</span></div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    <span class="comment">// = (cmd-&gt;q_des_hip[i+leg_0] + hip_offset[i+leg_0]) *</span></div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    <span class="comment">// hip_side_sign[i+leg_0]; spine_cmd-&gt;q_des_knee[i] =</span></div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    <span class="comment">// (cmd-&gt;q_des_knee[i+leg_0] + knee_offset[i+leg_0]) /</span></div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    <span class="comment">// knee_side_sign[i+leg_0];</span></div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a086b839ba0338f29486c0d717edf4df6">q_des_abad</a>[i] =</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;        (cmd-&gt;q_des_abad[i + leg_0] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ac1fd38ad01937d4e72d1fa18d7ac07aa">abad_side_sign</a>[i + leg_0]) +</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;        <a class="code" href="../../d1/d62/rt__spi_8cpp.html#af7ad08857cb188a9397a722c81e209da">abad_offset</a>[i + leg_0];</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a95fca9a480ef36ddb0b88ae43d02e4be">q_des_hip</a>[i] =</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;        (cmd-&gt;q_des_hip[i + leg_0] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a5cbed7f1261e2aed04c8d067ae264cf3">hip_side_sign</a>[i + leg_0]) +</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;        <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a9caf73d43c3d1105974099c178324048">hip_offset</a>[i + leg_0];</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a9fb21a7273775de6a14c708977b7d1b1">q_des_knee</a>[i] =</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        (cmd-&gt;q_des_knee[i + leg_0] / <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad3821639551d680117b0b03bf096edf4">knee_side_sign</a>[i + leg_0]) +</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a82d32662d77e7d0cbab964df5cef9d08">knee_offset</a>[i + leg_0];</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a44e5ebbd8f872bbd47c58a1ccef8eb67">qd_des_abad</a>[i] =</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;        cmd-&gt;qd_des_abad[i + leg_0] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ac1fd38ad01937d4e72d1fa18d7ac07aa">abad_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a95c23f774752b91bb39d0076922f5843">qd_des_hip</a>[i] =</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;        cmd-&gt;qd_des_hip[i + leg_0] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a5cbed7f1261e2aed04c8d067ae264cf3">hip_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#ab1d33b36ac21a9d0095d64631a9229bb">qd_des_knee</a>[i] =</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;        cmd-&gt;qd_des_knee[i + leg_0] / <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad3821639551d680117b0b03bf096edf4">knee_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a2d0b9ab5c3fa0d59d1f47dd53fdc173c">kp_abad</a>[i] = cmd-&gt;kp_abad[i + leg_0];</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a1751d6425518ce290183c0072a27756c">kp_hip</a>[i] = cmd-&gt;kp_hip[i + leg_0];</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a8e4d1c854c780a8856dfc12b0c01a2c9">kp_knee</a>[i] = cmd-&gt;kp_knee[i + leg_0];</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a8f59a4581aa55455be4ca030fcb6c97a">kd_abad</a>[i] = cmd-&gt;kd_abad[i + leg_0];</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a606ccb2cdfe9ba87f061c5a4100afeea">kd_hip</a>[i] = cmd-&gt;kd_hip[i + leg_0];</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a9b8cf071d8600afcfef0cfe43a9e45e6">kd_knee</a>[i] = cmd-&gt;kd_knee[i + leg_0];</div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;</div><div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a34f3a53ebfffc1805fdb83d18c1337f3">tau_abad_ff</a>[i] =</div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;        cmd-&gt;tau_abad_ff[i + leg_0] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ac1fd38ad01937d4e72d1fa18d7ac07aa">abad_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a6584e116c071b6da071e05bd01320505">tau_hip_ff</a>[i] =</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;        cmd-&gt;tau_hip_ff[i + leg_0] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a5cbed7f1261e2aed04c8d067ae264cf3">hip_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a3220a6d90b35478c7b8313fa464599f2">tau_knee_ff</a>[i] =</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;        cmd-&gt;tau_knee_ff[i + leg_0] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad3821639551d680117b0b03bf096edf4">knee_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#acedd54bdc9e7704b15709927bf536dae">flags</a>[i] = cmd-&gt;flags[i + leg_0];</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;  }</div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;  spine_cmd-&gt;<a class="code" href="../../d1/d9e/structspine__cmd__t.html#a429b53cc60d1d79cf6836ee79cee7453">checksum</a> = <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a0dd0e7733095f820e5edd3b6ed15b9b2">xor_checksum</a>((uint32_t *)spine_cmd, 32);</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;}</div><div class="ttc" id="rt__spi_8cpp_html_a9caf73d43c3d1105974099c178324048"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a9caf73d43c3d1105974099c178324048">hip_offset</a></div><div class="ttdeci">const float hip_offset[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00044">rt_spi.cpp:44</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a95c23f774752b91bb39d0076922f5843"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a95c23f774752b91bb39d0076922f5843">spine_cmd_t::qd_des_hip</a></div><div class="ttdeci">float qd_des_hip[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00052">rt_spi.h:52</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_acedd54bdc9e7704b15709927bf536dae"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#acedd54bdc9e7704b15709927bf536dae">spine_cmd_t::flags</a></div><div class="ttdeci">int32_t flags[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00063">rt_spi.h:63</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a6584e116c071b6da071e05bd01320505"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a6584e116c071b6da071e05bd01320505">spine_cmd_t::tau_hip_ff</a></div><div class="ttdeci">float tau_hip_ff[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00061">rt_spi.h:61</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a606ccb2cdfe9ba87f061c5a4100afeea"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a606ccb2cdfe9ba87f061c5a4100afeea">spine_cmd_t::kd_hip</a></div><div class="ttdeci">float kd_hip[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00058">rt_spi.h:58</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_af7ad08857cb188a9397a722c81e209da"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#af7ad08857cb188a9397a722c81e209da">abad_offset</a></div><div class="ttdeci">const float abad_offset[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00043">rt_spi.cpp:43</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a8e4d1c854c780a8856dfc12b0c01a2c9"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a8e4d1c854c780a8856dfc12b0c01a2c9">spine_cmd_t::kp_knee</a></div><div class="ttdeci">float kp_knee[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00056">rt_spi.h:56</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a429b53cc60d1d79cf6836ee79cee7453"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a429b53cc60d1d79cf6836ee79cee7453">spine_cmd_t::checksum</a></div><div class="ttdeci">int32_t checksum</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00064">rt_spi.h:64</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_ab1d33b36ac21a9d0095d64631a9229bb"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#ab1d33b36ac21a9d0095d64631a9229bb">spine_cmd_t::qd_des_knee</a></div><div class="ttdeci">float qd_des_knee[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00053">rt_spi.h:53</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a34f3a53ebfffc1805fdb83d18c1337f3"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a34f3a53ebfffc1805fdb83d18c1337f3">spine_cmd_t::tau_abad_ff</a></div><div class="ttdeci">float tau_abad_ff[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00060">rt_spi.h:60</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ad3821639551d680117b0b03bf096edf4"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ad3821639551d680117b0b03bf096edf4">knee_side_sign</a></div><div class="ttdeci">const float knee_side_sign[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00040">rt_spi.cpp:40</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a086b839ba0338f29486c0d717edf4df6"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a086b839ba0338f29486c0d717edf4df6">spine_cmd_t::q_des_abad</a></div><div class="ttdeci">float q_des_abad[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00048">rt_spi.h:48</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a9fb21a7273775de6a14c708977b7d1b1"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a9fb21a7273775de6a14c708977b7d1b1">spine_cmd_t::q_des_knee</a></div><div class="ttdeci">float q_des_knee[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00050">rt_spi.h:50</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a9b8cf071d8600afcfef0cfe43a9e45e6"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a9b8cf071d8600afcfef0cfe43a9e45e6">spine_cmd_t::kd_knee</a></div><div class="ttdeci">float kd_knee[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00059">rt_spi.h:59</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a1751d6425518ce290183c0072a27756c"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a1751d6425518ce290183c0072a27756c">spine_cmd_t::kp_hip</a></div><div class="ttdeci">float kp_hip[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00055">rt_spi.h:55</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a5cbed7f1261e2aed04c8d067ae264cf3"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a5cbed7f1261e2aed04c8d067ae264cf3">hip_side_sign</a></div><div class="ttdeci">const float hip_side_sign[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00039">rt_spi.cpp:39</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a44e5ebbd8f872bbd47c58a1ccef8eb67"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a44e5ebbd8f872bbd47c58a1ccef8eb67">spine_cmd_t::qd_des_abad</a></div><div class="ttdeci">float qd_des_abad[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00051">rt_spi.h:51</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a95fca9a480ef36ddb0b88ae43d02e4be"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a95fca9a480ef36ddb0b88ae43d02e4be">spine_cmd_t::q_des_hip</a></div><div class="ttdeci">float q_des_hip[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00049">rt_spi.h:49</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a3220a6d90b35478c7b8313fa464599f2"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a3220a6d90b35478c7b8313fa464599f2">spine_cmd_t::tau_knee_ff</a></div><div class="ttdeci">float tau_knee_ff[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00062">rt_spi.h:62</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a82d32662d77e7d0cbab964df5cef9d08"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a82d32662d77e7d0cbab964df5cef9d08">knee_offset</a></div><div class="ttdeci">const float knee_offset[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00045">rt_spi.cpp:45</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a8f59a4581aa55455be4ca030fcb6c97a"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a8f59a4581aa55455be4ca030fcb6c97a">spine_cmd_t::kd_abad</a></div><div class="ttdeci">float kd_abad[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00057">rt_spi.h:57</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a0dd0e7733095f820e5edd3b6ed15b9b2"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a0dd0e7733095f820e5edd3b6ed15b9b2">xor_checksum</a></div><div class="ttdeci">uint32_t xor_checksum(uint32_t *data, size_t len)</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00048">rt_spi.cpp:48</a></div></div>
<div class="ttc" id="structspine__cmd__t_html_a2d0b9ab5c3fa0d59d1f47dd53fdc173c"><div class="ttname"><a href="../../d1/d9e/structspine__cmd__t.html#a2d0b9ab5c3fa0d59d1f47dd53fdc173c">spine_cmd_t::kp_abad</a></div><div class="ttdeci">float kp_abad[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00054">rt_spi.h:54</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ac1fd38ad01937d4e72d1fa18d7ac07aa"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ac1fd38ad01937d4e72d1fa18d7ac07aa">abad_side_sign</a></div><div class="ttdeci">const float abad_side_sign[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00038">rt_spi.cpp:38</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-11" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-11-trigger" src="../../closed.png" alt="+"/> Here is the call graph for this function:</div>
<div id="dynsection-11-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-11-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_acc45f58dc7a8bffa48be85ef06e03309_cgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_acc45f58dc7a8bffa48be85ef06e03309_cgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_acc45f58dc7a8bffa48be85ef06e03309_cgraph" id="d1/d62/rt__spi_8cpp_acc45f58dc7a8bffa48be85ef06e03309_cgraph">
</map>
</div>
</p>

<p><div id="dynsection-12" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-12-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-12-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-12-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_acc45f58dc7a8bffa48be85ef06e03309_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_acc45f58dc7a8bffa48be85ef06e03309_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_acc45f58dc7a8bffa48be85ef06e03309_icgraph" id="d1/d62/rt__spi_8cpp_acc45f58dc7a8bffa48be85ef06e03309_icgraph">
</map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a884cb6c718f657f5aeef5e8b1b5619b7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void spine_to_spi </td>
          <td>(</td>
          <td class="paramtype">spi_data_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../de/de1/structspine__data__t.html">spine_data_t</a> *&#160;</td>
          <td class="paramname"><em>spine_data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>leg_0</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00235">235</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

<p>References <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00043">abad_offset</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00038">abad_side_sign</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00076">spine_data_t::checksum</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00075">spine_data_t::flags</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00044">hip_offset</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00039">hip_side_sign</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00045">knee_offset</a>, <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00040">knee_side_sign</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00069">spine_data_t::q_abad</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00070">spine_data_t::q_hip</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00071">spine_data_t::q_knee</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00072">spine_data_t::qd_abad</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00073">spine_data_t::qd_hip</a>, <a class="el" href="../../d0/dae/rt__spi_8h_source.html#l00074">spine_data_t::qd_knee</a>, and <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00048">xor_checksum()</a>.</p>
<div class="fragment"><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;                                                                         {</div><div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 2; i++) {</div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    data-&gt;q_abad[i + leg_0] = (spine_data-&gt;<a class="code" href="../../de/de1/structspine__data__t.html#a776dae7baac8bf802a361d52568fd3b8">q_abad</a>[i] - <a class="code" href="../../d1/d62/rt__spi_8cpp.html#af7ad08857cb188a9397a722c81e209da">abad_offset</a>[i + leg_0]) *</div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;                              <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ac1fd38ad01937d4e72d1fa18d7ac07aa">abad_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;    data-&gt;q_hip[i + leg_0] = (spine_data-&gt;<a class="code" href="../../de/de1/structspine__data__t.html#a14e92508cc8ff98cb852658fc139c202">q_hip</a>[i] - <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a9caf73d43c3d1105974099c178324048">hip_offset</a>[i + leg_0]) *</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;                             <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a5cbed7f1261e2aed04c8d067ae264cf3">hip_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;    data-&gt;q_knee[i + leg_0] = (spine_data-&gt;<a class="code" href="../../de/de1/structspine__data__t.html#ac79270d2aa95745b494c985842808074">q_knee</a>[i] - <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a82d32662d77e7d0cbab964df5cef9d08">knee_offset</a>[i + leg_0]) *</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;                              <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad3821639551d680117b0b03bf096edf4">knee_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;</div><div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;    data-&gt;qd_abad[i + leg_0] =</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;        spine_data-&gt;<a class="code" href="../../de/de1/structspine__data__t.html#a196030956f5918aaf80e4bfa17c6267d">qd_abad</a>[i] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ac1fd38ad01937d4e72d1fa18d7ac07aa">abad_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;    data-&gt;qd_hip[i + leg_0] = spine_data-&gt;<a class="code" href="../../de/de1/structspine__data__t.html#a81d4c922d234e0097a7e53090272f718">qd_hip</a>[i] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a5cbed7f1261e2aed04c8d067ae264cf3">hip_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;    data-&gt;qd_knee[i + leg_0] =</div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;        spine_data-&gt;<a class="code" href="../../de/de1/structspine__data__t.html#a453c3bb43111b6722b664f295da46318">qd_knee</a>[i] * <a class="code" href="../../d1/d62/rt__spi_8cpp.html#ad3821639551d680117b0b03bf096edf4">knee_side_sign</a>[i + leg_0];</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;    data-&gt;flags[i + leg_0] = spine_data-&gt;<a class="code" href="../../de/de1/structspine__data__t.html#a94e394f0291c6f52b35899ab54b90e91">flags</a>[i];</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;  }</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;</div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;  uint32_t calc_checksum = <a class="code" href="../../d1/d62/rt__spi_8cpp.html#a0dd0e7733095f820e5edd3b6ed15b9b2">xor_checksum</a>((uint32_t *)spine_data, 14);</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;  <span class="keywordflow">if</span> (calc_checksum != (uint32_t)spine_data-&gt;<a class="code" href="../../de/de1/structspine__data__t.html#ae29473391ce68697b43e91176742ade0">checksum</a>)</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;    printf(<span class="stringliteral">&quot;SPI ERROR BAD CHECKSUM GOT 0x%hx EXPECTED 0x%hx\n&quot;</span>, calc_checksum,</div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;           spine_data-&gt;<a class="code" href="../../de/de1/structspine__data__t.html#ae29473391ce68697b43e91176742ade0">checksum</a>);</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;}</div><div class="ttc" id="rt__spi_8cpp_html_a9caf73d43c3d1105974099c178324048"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a9caf73d43c3d1105974099c178324048">hip_offset</a></div><div class="ttdeci">const float hip_offset[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00044">rt_spi.cpp:44</a></div></div>
<div class="ttc" id="structspine__data__t_html_a94e394f0291c6f52b35899ab54b90e91"><div class="ttname"><a href="../../de/de1/structspine__data__t.html#a94e394f0291c6f52b35899ab54b90e91">spine_data_t::flags</a></div><div class="ttdeci">int32_t flags[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00075">rt_spi.h:75</a></div></div>
<div class="ttc" id="structspine__data__t_html_a776dae7baac8bf802a361d52568fd3b8"><div class="ttname"><a href="../../de/de1/structspine__data__t.html#a776dae7baac8bf802a361d52568fd3b8">spine_data_t::q_abad</a></div><div class="ttdeci">float q_abad[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00069">rt_spi.h:69</a></div></div>
<div class="ttc" id="structspine__data__t_html_a81d4c922d234e0097a7e53090272f718"><div class="ttname"><a href="../../de/de1/structspine__data__t.html#a81d4c922d234e0097a7e53090272f718">spine_data_t::qd_hip</a></div><div class="ttdeci">float qd_hip[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00073">rt_spi.h:73</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_af7ad08857cb188a9397a722c81e209da"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#af7ad08857cb188a9397a722c81e209da">abad_offset</a></div><div class="ttdeci">const float abad_offset[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00043">rt_spi.cpp:43</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ad3821639551d680117b0b03bf096edf4"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ad3821639551d680117b0b03bf096edf4">knee_side_sign</a></div><div class="ttdeci">const float knee_side_sign[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00040">rt_spi.cpp:40</a></div></div>
<div class="ttc" id="structspine__data__t_html_a453c3bb43111b6722b664f295da46318"><div class="ttname"><a href="../../de/de1/structspine__data__t.html#a453c3bb43111b6722b664f295da46318">spine_data_t::qd_knee</a></div><div class="ttdeci">float qd_knee[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00074">rt_spi.h:74</a></div></div>
<div class="ttc" id="structspine__data__t_html_a14e92508cc8ff98cb852658fc139c202"><div class="ttname"><a href="../../de/de1/structspine__data__t.html#a14e92508cc8ff98cb852658fc139c202">spine_data_t::q_hip</a></div><div class="ttdeci">float q_hip[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00070">rt_spi.h:70</a></div></div>
<div class="ttc" id="structspine__data__t_html_ac79270d2aa95745b494c985842808074"><div class="ttname"><a href="../../de/de1/structspine__data__t.html#ac79270d2aa95745b494c985842808074">spine_data_t::q_knee</a></div><div class="ttdeci">float q_knee[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00071">rt_spi.h:71</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a5cbed7f1261e2aed04c8d067ae264cf3"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a5cbed7f1261e2aed04c8d067ae264cf3">hip_side_sign</a></div><div class="ttdeci">const float hip_side_sign[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00039">rt_spi.cpp:39</a></div></div>
<div class="ttc" id="structspine__data__t_html_ae29473391ce68697b43e91176742ade0"><div class="ttname"><a href="../../de/de1/structspine__data__t.html#ae29473391ce68697b43e91176742ade0">spine_data_t::checksum</a></div><div class="ttdeci">int32_t checksum</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00076">rt_spi.h:76</a></div></div>
<div class="ttc" id="structspine__data__t_html_a196030956f5918aaf80e4bfa17c6267d"><div class="ttname"><a href="../../de/de1/structspine__data__t.html#a196030956f5918aaf80e4bfa17c6267d">spine_data_t::qd_abad</a></div><div class="ttdeci">float qd_abad[2]</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00072">rt_spi.h:72</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a82d32662d77e7d0cbab964df5cef9d08"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a82d32662d77e7d0cbab964df5cef9d08">knee_offset</a></div><div class="ttdeci">const float knee_offset[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00045">rt_spi.cpp:45</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_a0dd0e7733095f820e5edd3b6ed15b9b2"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#a0dd0e7733095f820e5edd3b6ed15b9b2">xor_checksum</a></div><div class="ttdeci">uint32_t xor_checksum(uint32_t *data, size_t len)</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00048">rt_spi.cpp:48</a></div></div>
<div class="ttc" id="rt__spi_8cpp_html_ac1fd38ad01937d4e72d1fa18d7ac07aa"><div class="ttname"><a href="../../d1/d62/rt__spi_8cpp.html#ac1fd38ad01937d4e72d1fa18d7ac07aa">abad_side_sign</a></div><div class="ttdeci">const float abad_side_sign[4]</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d62/rt__spi_8cpp_source.html#l00038">rt_spi.cpp:38</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-13" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-13-trigger" src="../../closed.png" alt="+"/> Here is the call graph for this function:</div>
<div id="dynsection-13-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-13-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a884cb6c718f657f5aeef5e8b1b5619b7_cgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a884cb6c718f657f5aeef5e8b1b5619b7_cgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a884cb6c718f657f5aeef5e8b1b5619b7_cgraph" id="d1/d62/rt__spi_8cpp_a884cb6c718f657f5aeef5e8b1b5619b7_cgraph">
</map>
</div>
</p>

<p><div id="dynsection-14" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-14-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-14-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-14-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a884cb6c718f657f5aeef5e8b1b5619b7_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a884cb6c718f657f5aeef5e8b1b5619b7_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a884cb6c718f657f5aeef5e8b1b5619b7_icgraph" id="d1/d62/rt__spi_8cpp_a884cb6c718f657f5aeef5e8b1b5619b7_icgraph">
</map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a0dd0e7733095f820e5edd3b6ed15b9b2"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t xor_checksum </td>
          <td>(</td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00048">48</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;                                                  {</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;  uint32_t t = 0;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; len; i++) t = t ^ data[i];</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;  <span class="comment">// t = t ^ ((data[i]&gt;&gt;8) + ((data[i] &amp; 0xff) &lt;&lt; 8));</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;  <span class="comment">// t = t ^ __bswap_16(data[i]);</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;  <span class="keywordflow">return</span> t;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;}</div></div><!-- fragment -->
<p><div id="dynsection-15" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-15-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-15-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-15-content" class="dyncontent" style="display:none;">
<div class="center"><img src="../../d1/d62/rt__spi_8cpp_a0dd0e7733095f820e5edd3b6ed15b9b2_icgraph.png" border="0" usemap="#d1/d62/rt__spi_8cpp_a0dd0e7733095f820e5edd3b6ed15b9b2_icgraph" alt=""/></div>
<map name="d1/d62/rt__spi_8cpp_a0dd0e7733095f820e5edd3b6ed15b9b2_icgraph" id="d1/d62/rt__spi_8cpp_a0dd0e7733095f820e5edd3b6ed15b9b2_icgraph">
</map>
</div>
</p>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="af7ad08857cb188a9397a722c81e209da"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const float abad_offset[4] = {0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00043">43</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ac1fd38ad01937d4e72d1fa18d7ac07aa"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const float abad_side_sign[4] = {-1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, -1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00038">38</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a5897797ad1ef937e551a794fff823e94"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const float disabled_torque[3] = {0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 0.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00035">35</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ab0513fd20c12aea68c75f0ac0e66db63"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../d1/d9e/structspine__cmd__t.html">spine_cmd_t</a> g_spine_cmd</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00024">24</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a1f4dd1dcb93301e0fbb6d1d04681afc0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../de/de1/structspine__data__t.html">spine_data_t</a> g_spine_data</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00025">25</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a9caf73d43c3d1105974099c178324048"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const float hip_offset[4] = {M_PI / 2.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, -M_PI / 2.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, -M_PI / 2.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, M_PI / 2.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00044">44</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a5cbed7f1261e2aed04c8d067ae264cf3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const float hip_side_sign[4] = {-1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, -1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 1.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00039">39</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a82d32662d77e7d0cbab964df5cef9d08"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const float knee_offset[4]</td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= {<a class="code" href="../../d0/dae/rt__spi_8h.html#ad525a9d72e9a7090f793511248bba3c9">K_KNEE_OFFSET_POS</a>, -<a class="code" href="../../d0/dae/rt__spi_8h.html#ad525a9d72e9a7090f793511248bba3c9">K_KNEE_OFFSET_POS</a>,</div><div class="line">                              -<a class="code" href="../../d0/dae/rt__spi_8h.html#ad525a9d72e9a7090f793511248bba3c9">K_KNEE_OFFSET_POS</a>, K_KNEE_OFFSET_POS}</div><div class="ttc" id="rt__spi_8h_html_ad525a9d72e9a7090f793511248bba3c9"><div class="ttname"><a href="../../d0/dae/rt__spi_8h.html#ad525a9d72e9a7090f793511248bba3c9">K_KNEE_OFFSET_POS</a></div><div class="ttdeci">#define K_KNEE_OFFSET_POS</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/dae/rt__spi_8h_source.html#l00030">rt_spi.h:30</a></div></div>
</div><!-- fragment -->
<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00045">45</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ad3821639551d680117b0b03bf096edf4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const float knee_side_sign[4] = {-.6429f, .6429f, -.6429f, .6429f}</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00040">40</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a6a80c54448b45967f3d0800dea73bf1d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">lcm::LCM* lcm_spi</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00012">12</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ac04c35971c92b7a0ddc152c107c02780"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t lsb = 0x01</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00017">17</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ad84522629d4afa65f28f64f5450bf871"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const float max_torque[3] = {17.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 17.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 26.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00033">33</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a57c6f94391b401d4ad7d4a30c7904e73"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int spi_1_fd = -1</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00019">19</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a072f113863622b6852dcc6af85b875ed"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int spi_2_fd = -1</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00020">20</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a80fda0db57659f3b440d379fbfd41a45"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned char spi_bits_per_word = 8</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00015">15</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a212699f517cb5bfb2bd42c24e9396a6b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">spi_command_t spi_command_drv</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00027">27</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ad5ebd4dd94dc79364380958849464508"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">spi_data_t spi_data_drv</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00028">28</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ae8f69f94e245c5175e96b2f3838685b0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int spi_driver_iterations = 0</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00186">186</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a7623d48573cd46df9d74654f507f0956"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned char spi_mode = SPI_MODE_0</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00014">14</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ad2b0c4c0380cc217d458a4f849dec246"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">pthread_mutex_t spi_mutex</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00031">31</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a2ecca08ad80721125d463d9ea82bab3f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int spi_speed = 6000000</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00016">16</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a1225355baf64e608a9d905c4b77df2ff"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">spi_torque_t spi_torque</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00029">29</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a2f7481e79512587f08318cd8ef4895e7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const float wimp_torque[3] = {6.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 6.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>, 6.<a class="el" href="../../dc/dd7/test__casadi_8cpp.html#ae20d7fba59865a21504b65cdb44cbfe5">f</a>}</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html#l00034">34</a> of file <a class="el" href="../../d1/d62/rt__spi_8cpp_source.html">rt_spi.cpp</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../dir_43e0a1f539e00dcfa1a6bc4d4fee4fc2.html">home</a></li><li class="navelem"><a class="el" href="../../dir_61bfb0b3cdda81b1b0355ba34eb3b1eb.html">dhkim</a></li><li class="navelem"><a class="el" href="../../dir_adee5b101e079090017bb4e91c628ead.html">Public_Repository</a></li><li class="navelem"><a class="el" href="../../dir_7fc07a7b97001e7b1d18e11da761e2de.html">Cheetah-Software</a></li><li class="navelem"><a class="el" href="../../dir_e69772fee2c25f3f3a3da98250dcdda2.html">robot</a></li><li class="navelem"><a class="el" href="../../dir_027de6e2baa5cad9e7e386445d8c74b0.html">src</a></li><li class="navelem"><a class="el" href="../../dir_f363271a5de137f1ed2fb1e5aa05c8fe.html">rt</a></li><li class="navelem"><a class="el" href="../../d1/d62/rt__spi_8cpp.html">rt_spi.cpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
